
public class TestMain {

	public static String getElementByKIndex(Data<?> [] datas,int K) {
		int i = 0;
		
		int j = 0;
		
		for(;i < datas.length - 1;++i) {
			for(;j < datas.length - i - 1;++j) {
				if(datas[j].toString().compareTo(datas[j + 1].toString()) > 0) {
					Data<?> tempData =  datas[j];
					datas[j] = datas[j+1];
					datas[j+1] = tempData;
				}
				
			}
		}
		
		return datas[K - 1].toString();
		
	}
	
	
	
	public static void main(String[] args) {
		
		//Data<?> [] datas = {new Data<String>("123"),new Data<Integer>(124),new Data<Number>(122)};
		Data<?> [] datas = {new Data<Integer>(110),new Data<Number>(122),new Data<Integer>(124),new Data<Number>(122),new Data<Integer>(199),new Data<Number>(122),new Data<Integer>(124),new Data<Number>(122)};
		//new Data<String>("宋文暄"),
		System.out.println(getElementByKIndex(datas,1)); // 最小
		System.out.println(getElementByKIndex(datas,(int)((datas.length / 2) + 0.5))); // 中间
		System.out.println(getElementByKIndex(datas,datas.length)); // 尾巴
		
		String strA = "李";
		String strB = "0";
		System.out.println(strA.compareTo(strB));
		
	}
	
}
